package com.example.script.admin.service.impl;


import com.example.script.admin.service.ProductService;
import com.example.script.mapper.ChooseScriptMapper;
import com.example.script.mapper.ScriptNameMapper;
import com.example.script.model.ChooseScriptExample;
import com.example.script.model.ScriptName;
import com.example.script.model.ScriptNameExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author CuiZhaolong
 * @DATE 2022/2/28
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ScriptNameMapper scriptMapper;
    @Autowired
    private ChooseScriptMapper chooseScriptMapper;

    /**
     * 根据名称查询剧本
     *
     * @param scriptName
     * @return
     */
    @Override
    public List<ScriptName> findScriptByName(String scriptName) {
        ScriptNameExample scriptExample = new ScriptNameExample();
        ScriptNameExample.Criteria criteria = scriptExample.createCriteria();
        criteria.andScriptnameEqualTo(scriptName);

        List<ScriptName> scriptList = scriptMapper.selectByExample(scriptExample);

        return scriptList;
    }

    /**
     * 根据邀请码查询已预约的玩家列表
     * @param invitationCode
     * @return
     */
    @Override
    public List<Long> findChooseByInvitationCode(String invitationCode) {
        ChooseScriptExample chooseScriptExample = new ChooseScriptExample();
        ChooseScriptExample.Criteria criteria=chooseScriptExample.createCriteria();
        criteria.andInvitationCodeEqualTo(invitationCode);
//        List<Long> chooseUserList=chooseScriptMapper.selectByExample();
        return null;
    }
    /**
     * 根据剧本id查询剧本游玩人数
     * @param ScriptId
     * @return
     */
    @Override
    public Long findScriptNopByScriptId(Long ScriptId) {

        return null;
    }
}
